#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
using namespace std;
const int N=1005;
const int INF=0x3f3f3f3f;
struct Edge{
    int from,to,cap,flow,next;
}edges[50*N];
int cnt,head[N];
int a[N];
int p[N];
int n,f,d,m;
int tmp;
char str[215];
void init(){
    cnt=0;
    memset(head,-1,sizeof(head));
}
void addEdge(int from,int to,int cap){
    edges[cnt]=Edge{from,to,cap,0,head[u]};
    head[u]=cnt++;
    edges[cnt]=Edge{to,from,0,0,head[v]};
    head[v]=cnt++;
}
void bfs(int s,int t){
    memset(a,0,sizeof(a));
    a[s]=INF;
    queue<int> q;
    q.push(s);
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(int i=head[v];i!=-1;i=edges[i].next){
            Edge &e=edges[i];
            if(!a[e.to] && e.cap>e.flow){
                p[e.to]=G[v][i];
                a[e.to]=min(a[v],e.cap-e.flow);
                q.push(e.to);
            }
        }
        if(a[t]){
            break;
        }
    }
}
int maxFlow(int s,int t){
    int flow=0;
    while(true){
        bfs(s,t);
        if(!a[t]){
            break;
        }
        for(int u=t;u!=s;u=edges[p[u]].from){
            edges[p[u]].flow+=a[t];
            edges[p[u]^1].flow-=a[t];
        }
        flow+=a[t];
    }
    return flow;
}
int main(void){
    //freopen("data.txt","r",stdin);
    while(~scanf("%d%d%d",&n,&f,&d)){
        int s=f+d+n*2+1;
        int t=f+d+n-2+2;
        for(int i=0;i<f;i++){
            scanf("%d",&tmp);
            addEdge(s,tmp,1);
        }
        for(int i=0;i<d;i++){
            scanf("%d",&tmp);
            addEdge(tmp,t,1);
        }
        for(int i=f+1;i<=f+n;i++){
            addEdge(i,i+n,1);
        }
        for(int i=f+1;i<=f+n;i++){
            scanf("%s",str);
            int l=strlen(str);
            for(int j=1;j<=l;j++){
                if(str[j]=='Y'){
                    addEdge(j,i,1);
                }
            }
        }
        for(int i=f+n+1;i<=f+2*n;i++){
            scanf("%s",str);
            int l=strlen(str);
            for(int j=1;j<=l;j++){
                if(str[j]=='N'){
                    addEdge(i,j+f+2*n+1,1);
                }
            }
        }
        int ans=maxFlow(s,t);
        printf("%d\n",ans);
    }
    return 0;
}